package grpc

import (
	xtime "git.huoys.com/middle-end/kratos/pkg/time"
	pb "gitee.com/rzttw/http/api"
	"time"

	"git.huoys.com/middle-end/kratos/pkg/net/rpc/warden"
)

// New new a grpc server.
func New(svc pb.HttpServer) (ws *warden.Server, err error) {
	cfg := &warden.ServerConfig{
		Addr: "0.0.0.0:9002",
		Timeout: xtime.Duration(time.Second*2),
	}

	ws = warden.NewServer(cfg)
	pb.RegisterHttpServer(ws.Server(), svc)
	ws, err = ws.Start()
	return
}
